home *** CD-ROM | disk | FTP | other *** search
/ Nibble Magazine / nib15.dsk / APPLE IIE CHARACTER SET DEMO.bas next >
BASIC Source File  |  2023-02-26  |  4KB  |  63 lines

  1. 100  REM  ***********************************************************
  2. 110  REM  *                                                         *
  3. 120  REM  *  Apple //e CHARACTER SET DEMO:  Displays alternate and  *
  4. 130  REM  *  primary character sets with 80 column card on and off  *
  5. 140  REM  *                                                         *
  6. 150  REM  *                    by Sandy Mossberg                    *
  7. 160  REM  *                                                         *
  8. 170  REM  ***********************************************************<CTRL-J>
  9. 180  REM     Machine language subroutines and equates:
  10. 190  REM        768  COUTSP  LDA $06
  11. 200  REM        770          JSR $FDED   ;print character in $06 (ASCII)
  12. 210  REM        773  OUTSP   JMP $DB57   ;print space
  13. 220  REM        776  PRHEX   LDA $07
  14. 230  REM        778          JMP $FDE3   ;print low nybble in $07 (HEX)<CTRL-J>
  15. 240  FOR I = 768 TO 780: READ N: POKE I,N: NEXT I
  16. 250  DATA  165,6,32,237,253,76,87,219,165,7,76,227,253
  17. 260 CHAR = 6:NYBBLE = 7:COUTSP = 768:OUTSP = 773:PRHEX = 776: REM <CTRL-J>
  18. 270  REM     Soft switch equates:
  19. 280  REM        ALTCHARSET: OFF  (FALT) = 49166 ($C00E)
  20. 290  REM                    ON   (NALT) = 49167 ($C00F)
  21. 300  REM                    READ (RALT) = 49182 ($C01E)
  22. 310  REM        PAGE2:      OFF  (FPG2) = 49236 ($C054)
  23. 320  REM                    ON   (NPG2) = 49237 ($C055)<CTRL-J>
  24. 330 FALT = 49166:NALT = 49167:RALT = 49182:FPG2 = 49236:NPG2 = 49237: REM <CTRL-J>
  25. 340  REM   Read character set and print it on top line.<CTRL-J>
  26. 350  HOME : IF  PEEK(RALT) >128  THEN  GOSUB 710: GOTO 380
  27. 360  GOSUB 720: REM <CTRL-J>
  28. 370  REM   Print column headers ("ones place").<CTRL-J>
  29. 380  PRINT : HTAB 5: FOR I = 0 TO 15: POKE NYBBLE,I: CALL PRHEX: CALL OUTSP: NEXT I: PRINT : PRINT : REM <CTRL-J>
  30. 390  REM   Print row headers ("tens place").<CTRL-J>
  31. 400  FOR I = 0 TO 255  STEP 16: POKE NYBBLE,I/16: CALL PRHEX: POKE NYBBLE,0: CALL PRHEX: REM <CTRL-J>
  32. 410  REM  Determine 80 column card (slot 3) activity by checking
  33. 420  REM  for $C3 (195) in high order byte of output hook (55,$37)
  34. 430  REM  or true output handler of DOS (43604,$AA54).<CTRL-J>
  35. 440  IF  PEEK(55) < >195  AND  PEEK(43604) < >195  THEN 520: REM <CTRL-J>
  36. 450  REM   80 column card active. Non-control characters print normally.<CTRL-J>
  37. 460  IF I < >0  AND I < >16  AND I < >128  AND I < >144  THEN 530: REM <CTRL-J>
  38. 470  REM  80 column card active. Convert positive ASCII control
  39. 480  REM  characters to normal characters and mark them.<CTRL-J>
  40. 490  IF I = 0  OR I = 16  THEN  PRINT "->";: FOR J = I TO I +15: POKE CHAR,J +192: GOTO 540: REM <CTRL-J>
  41. 500  REM  80 column card active or inactive. Convert negative ASCII
  42. 510  REM  control characters to normal characters and mark them.<CTRL-J>
  43. 520  IF I = 128  OR I = 144  THEN  PRINT "->";: FOR J = I TO I +15: POKE CHAR,J +64: GOTO 540
  44. 530  PRINT "  ";: FOR J = I TO I +15: POKE CHAR,J
  45. 540  CALL COUTSP: NEXT J: PRINT : NEXT I: REM <CTRL-J>
  46. 550  REM  Control line - switch character sets or end.<CTRL-J>
  47. 560  VTAB 23: PRINT "SWITCH or END (ANY KEY/E)? ";
  48. 570  VTAB 23: HTAB 28: GET A$: REM <CTRL-J>
  49. 580  REM  End it all.<CTRL-J>
  50. 590  IF A$ = "E"  THEN  END : REM <CTRL-J>
  51. 600  REM  Switch. Read 80 column card activity.<CTRL-J>
  52. 610  IF  PEEK(55) = 195  OR  PEEK(43604) = 195  THEN 690: REM <CTRL-J>
  53. 620  REM  Read first screen character on text page 1. If "A" then
  54. 630  REM  switch to primary set; if "P", switch to secondary set.<CTRL-J>
  55. 640  IF  CHR$( PEEK(1024) -128) = "A"  THEN  POKE FALT,0: POKE FPG2,0: GOSUB 720: GOTO 570
  56. 650  POKE FPG2,0: POKE NALT,0: GOSUB 710: GOTO 570: REM <CTRL-J>
  57. 660  REM  If 80 column card active, to read first character on text
  58. 670  REM  page 1 (even numbered column), turn auxilliary memory
  59. 680  REM  ("PAGE2") on. Truth is stranger than fiction!<CTRL-J>
  60. 690  POKE NPG2,0: GOTO 640: REM <CTRL-J>
  61. 700  REM  Subroutines to print title on top line.<CTRL-J>
  62. 710  PRINT : VTAB 1: PRINT "ALTERNATE CHARACTER SET:": RETURN 
  63. 720  PRINT : VTAB 1: PRINT "PRIMARY CHARACTER SET:  ": RETURN